A web server receives an HTTP (Hyper-Text Transfer Protocol) request from an entity (i.e., a client) requesting World Wide Web (hereinafter referred to as “Web”) services to the web server, and provides a response, e.g., a web page, to the HTTP request, to the client. In addition, a web application server, i.e., WAS, is a software engine, running web applications for the client via HTTP protocol on a network, or a hardware including the software engine.
In general, to process WebSocket connection between the web server and the WAS, the web server and the WAS may be connected and working in a reverse proxy mode. In this case, the web server only serves as a tunnel to simply pass WebSocket messages from the client to the WAS without checking the WebSocket messages.
For a reference, a reverse proxy used in the reverse proxy mode may be a kind of proxy server that retrieves resources from one or more servers in an intranet, for example, the proxy server receives requests from Internet and forwards the requests to other servers in the intranet.
However, a problem may appear when the reverse proxy mode is adopted. In detail, under a circumstance that each of clients using WebSocket and the proxy server has each corresponding connection, the number of the connection in the reverse proxy mode increases as the number of the clients increments. For example, on condition that a first client is in a state of being connected to the proxy server via one of connections established under reverse proxy mode, namely a first connection, if a second client intends to send a WebSocket request message, the second client has to make another connection, referred to as a second connection. In detail, the first connection cannot be utilized to forward and receive the WebSocket request message of the second client. Thus, as the number of the clients sending the request message increases, the number of the connection increments. Consequently, a problem with a waste of the number of the connection occurs under an environment that the web server and the WAS are connected via the existing connections established by the reverse proxy mode.
Also, another problem may arise under the same circumstance. In detail, due to a context switching incurred at the WAS, a function of the WAS switches from a selector mode to a worker mode, resulting in an inefficient execution of the function at the WAS. For example, in WAS, the context switching may occur to perform to be in the selector mode while performing in the worker mode on the condition that the WAS receives a predetermined request message from the web server. Hence, the context switching problem which contributes to the inefficacy of the operation of the WAS exists.
Besides, still another problem with improper load balancing exists under the environment as mentioned above and additionally under such an environment as configurations of the WAS changes dynamically, like in a cloud computing context. For example, in case of adding one new WAS into a group of two operating WASs on the condition that load status of the two WASs in use are already heavy, a problem may arise with a web server which applies a round robin approach to each WAS due to the fact that request messages from new clients, even if the new WAS is added into the group, may not be delivered to the two WASs through the existing connections, and thus proper load balancing cannot be achieved.
Therefore, in order to (i) avoid the problem of wasting the number of the connections between the web server and the WAS established by the reverse proxy mode, (ii) avert the problem of inefficient performance of the functions of the WAS due to the context switching, (iii) prevent the overload of the WASs, and (iv) implement efficient load balancing, the applicant comes up with the present invention.